package com.clqteam.daoimpl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import com.clqteam.dao.InsertVIPLXGDao;
import com.clqteam.util.JDBCutil;
/**
 * 增加vip
 * @author Administrator
 *LXG
 */
public class InsertVIPLXGDaoImpl implements InsertVIPLXGDao {
	/**
	 * 增加vip
	 * @param vPoint 积分
	 * @param pitRate 转化率
	 * @param vDiscount 折扣率
	 * @return boolean
	 * 
	 */
	@Override
	public boolean insertVIP(int vPoint, double pitRate, double vDiscount) {
		boolean b=false;
		StringBuffer sql = new StringBuffer();
		sql.append(" INSERT INTO s_vip (s_vip.vPoint,s_vip.pitRate,s_vip.vDiscount,s_vip.vTime)");
		sql.append(" VALUES (?,?,?,CURDATE())");
		Connection con = JDBCutil.getConnection();
		try {
			PreparedStatement pst = con.prepareStatement(sql.toString());
			pst.setInt(1, vPoint);
			pst.setDouble(2, pitRate);
			pst.setDouble(3, vDiscount);
			
			int i = pst.executeUpdate();
			if(i>0){
				b=true;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	
		return b;
	}

}
